/*
 * IO_card.c
 *
 * Created: 11.10.2012 09:52:17
 *  Author: bardbakk
 */ 

#define F_CPU 11059200
#include "definitions.h"
#include "CAN.h"
#include "USART.h"
#include "SPI.h"
#include "MCP2515.h"
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/delay.h>

int main(void)
{
	//cli();
	DDRC = 0xFF;
	PORTC = 0xFF;	
	
	CAN_init();
	
	
	BIT_SET(DDRC, DDC0);

	//uint8_t status;
	//uint8_t b = 'A';
	
	CAN_message_t a;
	a.length = 8;
	a.id = 255;
	a.data[0] = 104;
	a.data[1] = 101;
	a.data[2] = 105;
	
	sei();
	
	uint8_t res = MCP2515_read(MCP_CANCTRL);
	if(BIT_CHECK(res, 6))
	{
			BIT_CLEAR(PORTC, PC1);
	}

    while(1)
    {	
		int i;
		//CAN_message_send(a);
		
    }
}